<%@ page import="java.util.List" %>
<%@ page import="pojoCla.UserMsg" %>
<%@ page import="pojoCla.NewsChnl" %><%--
  Created by IntelliJ IDEA.
  User: zhazha
  Date: 2021/9/1
  Time: 11:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <link href="../css/main.css" rel="stylesheet">
    <%
        Object user = session.getAttribute("user");
        if(user == null){
            response.sendRedirect("../login.jsp");
            return;
        }

    %>
</head>
<body>
<div class="AccountManagement_c " id="AccountManagement_c">
    <h3>账户管理
        <div class="amcl fr">
            <input type="text" placeholder="用户名" class="fl"  id="selAcct" name="" value="${sessionScope.searchAcct}">
            <div class="search fl" id="searchUser"><img src="../images/search.png"></div>
        </div>
    </h3>
    <div class="AM_ct text_center">
        <div class="AM_ct_in">
            <div class="add_btn df_btn fl" id="add_Account_btn">添加</div>
            <div class="edit_btn df_btn fl" id="edit_Account_btn">编辑</div>
            <div class="delete_btn df_btn fl" id="delete_Account_btn">删除</div>
            <div class="fr df_btn ac_btn" id="ac_Account_btn">账号授权</div>
        </div>
    </div>

    <div class="list">
        <ul class="list_h">
            <li class="b20"><label><span>用户名</span></label></li>
            <li class="b20"><label>密码</label></li>
            <li class="b60"><label>授权形式</label></li>
        </ul>
        <div class="list_b_c">
            <%

                List<UserMsg> list = (List<UserMsg>) session.getAttribute("list");
                if(list.size() > 0){
                    for(UserMsg um: list){
                    %>
            <ul class="list_b">
                <li class="b20"><label><input type="checkbox" name="user"><span><%=um.getAcct() %></span></label></li>
                <li class="b20"><label><%=um.getPwd()%></label></li>
                <li class="b60"><label id="userChnl"><%=um.getChnlName()%></label></li>
            </ul>
            <%
                    }
                }else{
                    %>
            <ul class="list_null">
                <li class="text_center">未找到管理员账户！</li>
            </ul>
            <%
                    }
            %>

        </div>
        <div class="pull_page" id="userPage">
            <div class="fl pull_page_up"  name="1">首页</div>
            <ul>
                <li id="userUp" name="${sessionScope.pageIndex-1}">上一页</li>
                <li class="on">${sessionScope.pageIndex}</li>
                <li id="userDown" name="${sessionScope.pageIndex + 1}">下一页</li>
            </ul>
            <div class="fl pull_page_down"  name="${sessionScope.sumPage}">末页</div>&nbsp;&nbsp;
            <span class="pull_page_down">总页数:${sessionScope.sumPage}</span>
        </div>
    </div>
</div>



<!-- 弹窗 -->
<!-- 添加账户 -->
<div class="add_Account dn" id="add_Account">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                添加账户
                <span class="fr add_Account_close"><img src="../images/close.png"></span>
            </div>
        </div>
        <div class="user_name user_i">
            <label>用户名</label> <input type="text" placeholder="输入用户名" id="addAcct" value=""><br>
            <span style="color: red" id="addUserNameErr"></span>
        </div>

        <div class="user_password user_i">
            <label>密<i>调</i>码</label> <input type="password" placeholder="输入密码" id="addPwd" value=""><br>
            <span style="color: red" id="addUserPWDErr"></span>
        </div>

        <div class="add_Account_ok_btn text_center" id="add_Account_ok_btn">确<i>皮</i>定</div>
    </div>
</div>

<!-- 账户编辑 -->
<div class="add_Account dn" id="user_column">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                编辑账户
                <span class="fr add_Account_close"><img src="../images/close.png"></span>
            </div>
        </div>
        <div class="column_now ">正在编辑 “<span id="editAcct"></span>”账户</div>
        <div class="user_name user_i">
            <label>用户名</label> <input type="text" placeholder="输入用户名" name="username" id="editUser" value=""><br>
            <span style="color: red" id="editUserNameErr"></span>
        </div>
        <div class="user_password user_i">
            <label>密<i>调</i>码</label> <input type="password" placeholder="输入密码" name="" id="editPwd" value=""><br>
            <span style="color: red" id="editUserPWDErr"></span>
        </div>
        <div class="add_Account_ok_btn text_center" id="user_column_ok_btn">确<i>皮</i>定</div>
    </div>
</div>

<!-- 删除账户 -->
<div class="add_Account dn" id="delete_Account">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                删除账户
                <span class="fr add_Account_close"><img src="../images/close.png"></span>
            </div>
        </div>
        <div class="delete_text">确定删除“ <span id="deleteAcct"></span> ”账户吗？</div>
        <div class="add_Account_ok_btn text_center" id="delete_Account_ok_btn">确<i>皮</i>定</div>
    </div>
</div>

<!-- 账户授权 -->
<div class="add_Account dn" id="ac_Account">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                账户栏目授权
                <span class="fr add_Account_close"><img src="../images/close.png"></span>
            </div>
        </div>
        <ul>
            <%
                List<NewsChnl> chnlList = (List<NewsChnl>) session.getAttribute("chnlList");
                if(chnlList.size() > 0){
                    for(NewsChnl chnl:chnlList){
                        %>
            <li><label><input type="checkbox" name="chnlName">&nbsp;<span name="allChnl"><%=chnl.getName() %></span></label></li>
            <%
                    }
                }else{
                    %>
            <li><label><span>没有找到栏目</span></label></li>
            <%
                    }
            %>
        </ul>
        <div class="add_Account_ok_btn text_center" id="ac_Account_ok_btn">保<i>呀</i>存</div>
    </div>
</div>
</body>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/main.js"></script>
<script type="text/javascript">
    var addUserMSG = "${sessionScope.addUserMSG}";
    var delUserMSG = "${sessionScope.delUserMSG}";
    var editUserMSG  = "${sessionScope.editUserMSG}";
    var accUserMSG = "${sessionScope.accUserMSG}";
    if(addUserMSG != ""){
        alert(addUserMSG);
    }else if(delUserMSG != ""){
        alert(delUserMSG);
    }else if(editUserMSG != ""){
        alert(editUserMSG);
    }else if(accUserMSG != ""){
        alert(accUserMSG);
    }
    <%
    session.removeAttribute("accUserMSG");
    session.removeAttribute("editUserMSG");
    session.removeAttribute("delUserMSG");
    session.removeAttribute("addUserMSG");
    %>
</script>
</html>
